<?php

/**
 * Controller is the customized base controller class.
 * All controller classes for this application should extend from this base class.
 */
class AController extends CController {

    public $layout = '//layouts/admin/main';
    public $menu   = array();
    public $debug       = false;
    public $breadcrumbs = array();
    public $encodeLabel = true;

    public function init() {
        $this->pageTitle = Yii::t('app', 'AdminTitle');
    }

    //Fixed register jquery.js bath to suit log module
    protected function beforeAction($action) {
        Yii::app()->getClientScript()->registerCoreScript('jquery');
        return true;
    }

    public function filters() {
        return array(
            'accessControl',
        );
    }

    public function accessRules() {
        return array(
            array('allow',
                'actions' => array('login', 'logout', 'error'),
                'users' => array('*'),
            ),
            array('allow',
                'users' => array('@'),
            ),
            array('deny',
                'users' => array('*'),
            ),
        );
    }

    public function actionClearState() {
        SpsState::clearState();
    }

}